<?php

/**
 * +------ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER * ---------+
 * +----------------------------------------------------------------------------+
 * | PHPKiisf - Keep It in Simple Framework										|
 * | Version 1.0																|
 * | Copyright (C) <2013>  Mario Cezzare <mcezzare@gmail.com>					|
 * | Blog: http://mcezzare.blogspot.com.br										|
 * |																			|
 * | This program is part of PHPKiisf, and is free software: you can			|
 * | redistribute it and/or modify it under the terms of the GNU 				|
 * | General Public License as published by										|
 * | the Free Software Foundation, either version 3 of the License, or			|
 * | (at your option) any later version.										|
 * |																			|
 * | This program is distributed in the hope that it will be useful,			|
 * | but WITHOUT ANY WARRANTY; without even the implied warranty of				|
 * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the				|
 * | GNU General Public License for more details.								|
 * | You should have received a copy of the GNU General Public License			|
 * | along with this program.  If not, see <http://www.gnu.org/licenses/>.		|
 * +----------------------------------------------------------------------------+
 * | Author : <Mario Cezzare Angelicola Chiodi> <mcezzare@gmail.com>			|
 * +----------------------------------------------------------------------------+
 * | Contributors																|
 * |																			|
 * +----------------------------------------------------------------------------+
 *
 */

/**
 * Call the famous index.php
 *
 * @package	Templates
 * @access	public
 * @since	2013-03-08
 * @author	Mario Cezzare <mcezzare@gmail.com>
 */
class example_template extends base_template {

		public static $name_file;
		public static $section_name	 = "Examples";
		public static $params			 = array( );

		public function __construct() {
				self::init();
		}

		public static function init() {

				self::$name_file = TEMPLATES_DIR . "/pages/examples_index";
				parent::$name_file = self::$name_file;
				parent::$section_name = self::$section_name;
				self::_load();
		}

		/**
		 * Verify if definitions of template are correct,
		 * else inform user the error
		 *
		 * @return Simple execute and continue executing on the caller function
		 * normally a *_controller.class.php, invoked by dispatcher
		 */
		public static function _load() {

				self::$public_dir = sprintf( "%sskins/%s" , TEMPLATES_DIR , self::$skin );
				$template_config = sprintf( "%s" , self::$name_file . INCLUDE_EXTENSION );

				if ( utils::check_template( $template_config ) ) {
						require_once $template_config;
						return;
				}
				else {
						$message = utils::prepare_message(
										array(
												"MSG_TYPE" => "ERROR" ,
												"OPERATION" => "EXAMPLES_HOME_TEMPLATE NOT_FOUND" ,
												"DETAIL" => "called from " . __CLASS__ . " looking for $template_config . " ,
										)
						);
						utils::inform_user( $message );
						return;
				}
		}

}

//load the page
if ( spl_autoload_register( 'example_template::init' ) ) {
		example_template::init();
}
?>

